|
LM SET AMBIENT OCCLUSION ON
This command modifies the ambient light to have less effect in crowded and dark spaces, it can be an expensive process but produces better looking results than standard ambient lighting.
LM Set Ambient Occlusion On Number Of Rays, Ray Length#, Pattern
Number Of Rays
The number of rays to cast to check for nearby obstacles.
Ray Length#
The average distance rays should be when checking for obstacles.
Pattern
The type of pattern to use for the rays, 0=random, 1=fixed.
This command does not return a value.
The process works by casting a set number of rays in a hemispherical pattern from each point in your scene to work out which areas are close to other geometry. Areas which are covered will be set to receive less of the ambient light than an area that is out in the open, which will be set to receive full ambient light. The following picture shows a scene rendered with three different settings, the first with no ambient light and a single point light shining down. The second has a constant ambient light applied using the LM Set Ambient Light command, but with no ambient occlusion, this results in all areas that were previously in shadow to be brightened by the same amount. You still cannot make out the detail in the shadow cast by the point light. The third uses ambient occlusion to set points near the base of the sphere as darker than those that are more out in the open. The shadow is still brightened but in a smooth manner from the base of the sphere to the edge of the shadow and the details behind the sphere can now be seen much more clearly.

The Number Of Rays parameter sets how many rays will be cast per pixel when it tries to determine how open space exists above the pixel. The higher the number of rays the more accurate the result but the longer it takes to calculate. A good value to use is around 100. The value has a large impact on performance, higher values will slow the process down. The Ray Length parameter sets the average length rays will be when checking for nearby obstacles, the maximum ray length will be twice this value. A good value to use is about 30, but it depends on the scale of your level. Typically the width of a door in your scene is about right. This value has a small impact on performance, higher values will slow the process down. The Pattern parameter defines how the set of rays is calculated, using 1 is a fixed pattern that calculates a set of random rays and uses it for every point, using 0 creates a set of random rays for each point. Using a fixed pattern produces better looking results but requires a lot of rays. A completely random pattern can be set to use less rays (say 20) to get a quick idea of which areas are going to get darkened by ambient occlusion before changing to a fixed pattern with more rays for a final result. The following shows the above scene with a random pattern (0) with a low number of rays (20) resulting in a quick draft of what the scene might look like with ambient occlusion in a fraction of the time.

Ambient occlusion usually takes a very long time to calculate for good quality results. This does not depend on the number of lights you have added, and can be calculated with no additional lights.
|